﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;
using System.IO;
using System.Windows.Media.Imaging;

namespace Sanctuary
{
    public partial class TestZipFileOpen : UserControl
    {
        public event StartSeledtedEventHandler StartSelected;

        public TestZipFileOpen()
        {
            InitializeComponent();
        }

        private void bOpenFileDialog_Click(object sender, RoutedEventArgs e)
        {
            // Create an instance of the open file dialog box.
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            // Set filter options and filter index.
            openFileDialog1.Filter = "Zip Files (.zip)|*.zip";

            openFileDialog1.FilterIndex = 1;

            // Process input if the user clicked OK.
            if (openFileDialog1.ShowDialog() == true)
            {
                // Open the selected file to read.
                ZipStream = openFileDialog1.File.OpenRead();

                if (StartSelected != null)
                {
                    StartSelected();
                }                
            }
        }

        public Stream ZipStream { get; private set; }
    }
}
